﻿@using DirectSell.Model.User
@model UserInforMationDetails
@{
    ViewBag.Title = "Edit";
    Layout = "~/Areas/Manager/Views/Shared/ManagerLayout.cshtml";
}
    <article class="page-container">
        <form id="ajaxCondition" class="form form-horizontal">
            <div class="row cl" style="display:none">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>会员编号：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="@Model.UserCode" placeholder="" id="UserCode" name="UserCode" required>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>姓名：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="@Model.UserName" placeholder="" id="UserName" name="UserName" required>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>身份证号：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="@Model.IdNumber" placeholder="" id="IdNumber" name="IdNumber" required>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机号：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="@Model.Phone" placeholder="" name="Phone" id="Phone" required>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>银行名称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="@Model.BankName" placeholder="" name="BankName" id="BankName" required>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>银行账号：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="@Model.BankCode" placeholder="" name="BankCode" id="BankCode" required>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>持卡人姓名：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="@Model.CardHolder" placeholder="" name="CardHolder" id="CardHolder" required>
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </article>
}
<script>
    $('#ajaxCondition').on('submit', function () {
        layer.confirm('确定要修改用户资料？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            formPost();
        }, function () {
            layer.close();
        });
        event.preventDefault() //阻止form表单默认提交
    })
    function formPost() {
        //加载层
        var index = layer.load(1, {
            shade: [0.1, '#fff']
        });
        $.ajax({
            type: "post",
            url: "/Manager/MemberList/EditMessage",
            data: $('#ajaxCondition').serialize(),
        }).success(function (message) {
            console.log(message);
            if (message == false) {
                layer.msg('资料修改失败', { icon: 2 });
                return;
            }
           layer.msg('资料修改成功', { icon: 1 });
        }).fail(function (err) {
            layer.msg('系统错误,请稍后重试', { icon: 2 });
        })
        layer.close(index)//关闭加载层
    }

</script>